package com.xiyu.service.controller.admin.customer;
import com.xiyu.service.vo.customer.customerPool.CustomerPoolAllocationOutput;
import com.xiyu.service.vo.customer.customerPool.CustomerPoolAllocationInput;
import com.xiyu.service.vo.customer.customerPool.CustomerPoolReceiveOutput;
import com.xiyu.service.vo.customer.customerPool.CustomerPoolReceiveInput;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import jakarta.validation.*;

import java.util.*;

import com.xiyu.service.framework.web.web.core.pojo.PageResult;
import com.xiyu.service.framework.web.web.core.pojo.CommonResult;
import static com.xiyu.service.framework.web.web.core.pojo.CommonResult.success;

import com.xiyu.service.framework.excel.core.util.ExcelUtils;

import com.xiyu.service.framework.operateLog.core.annotations.OperateLog;
import static com.xiyu.service.framework.operateLog.core.enums.OperateTypeEnum.*;

import com.xiyu.service.service.customer.CustomerPoolService;

@Tag(name = "公海客户")
@RestController
@RequestMapping("/customer/customer-pool")
@Validated
public class CustomerPoolController {

    @Resource
    private CustomerPoolService customerPoolService;

    @PostMapping("/receive")
    @Operation(summary = "领取")
    @PreAuthorize("@ss.hasPermission('customer:customerPool:receive')")
    public CommonResult<List<CustomerPoolReceiveOutput>> receive(@Valid @RequestBody CustomerPoolReceiveInput inputVO) {
        return success(customerPoolService.receive(inputVO));
    }

    @PostMapping("/allocation")
    @Operation(summary = "分配")
    @PreAuthorize("@ss.hasPermission('customer:customerPool:allocation')")
    public CommonResult<List<CustomerPoolAllocationOutput>> allocation(@Valid @RequestBody CustomerPoolAllocationInput inputVO) {
        return success(customerPoolService.allocation(inputVO));
    }

}
